import json

a = []
with open("log", "r") as f:
    for i in f.readlines():
        tmp = json.loads(i.strip())
        if "user6" in i.strip():
            print(i.strip())
        a.append(tmp["user"])
print(a)
a1 = list(set(a))
print(a1)
# ['zhang3', 'admin1', 'administrator', 'user8', 'admin2', 'user7', 'user6']

from collections import Counter

# 使用Counter统计每个元素的个数
counter = Counter(a)

# 输出结果
for item, count in counter.items():
    print(f" {item} 出现了 {count} 次")
